home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-04-19 | 1007 b | 49 lines | [TEXT/PJMM] |
- unit DynamicMath;
-
- { Dynamic Math. A library to parse and interpret formulas during }
- { the programs execution time }
- {}
- { © 1993 by Christian Franz }
-
- interface
-
- const
-
- eClsExpected = -1; (* ")" expected *)
- eOpnExpected = -2; (* "(" expected *)
- eUnknownSymbol = -3; (* unknown function *)
- eSyntaxError = -4; (* formula is wrong. usually missing '(' ')' around Expr *)
-
- {$PUSH}
- {$J+}
-
- type
- (* The Item object is just defined so your *)
- (* compiler doesn't gag on the Formula *)
- (* definition. Don't change or even use it! *)
- Item = object (* don't ever mess with me *)
- thevalue: real;
- negate: boolean;
- function evaluate: real; (* no you don't *)
- end;
-
- Formula = object
- structure: Item;
- function evaluate (x, y: real): real;
- (* call me to evaluate parsed function *)
- end;
-
- var
- gPos: integer;
-
- {$J-}
- {POP}
-
-
- procedure Str2Text (s: Str255; var t: CharsHandle);
-
- function Parse (text: CharsHandle; var theFormula: Formula): Integer;
-
- implementation
-
- end.